<template>
    <div>
            <Card>
                <p slot="title">
				    企业认证审核
			    </p>
                <div>
                    <Form class="step-form" ref="userData" :model="userData" :label-width="100">
                       <Row span="12">
                            <i-col span="12" >
                                <FormItem label="企业名称：" label-position="left" :label-width="150">
                                    <Input  :disabled="hasSubmit" v-model="userData.name" type="text" placeholder="输入数据不能为空" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="法人姓名：" label-position="left" :label-width="150">
                                    <Input :disabled="hasSubmit" v-model="userData.legalPerson" type="text" placeholder="输入数据不能为空" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="法人身份证号：" label-position="left" :label-width="150">
                                    <Input :disabled="hasSubmit" v-model="userData.legalCard" type="text" placeholder="输入数据不能为空" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="法人手机号：" label-position="left" :label-width="150">
                                    <Input :disabled="hasSubmit" v-model="userData.legalPhone" type="text"/>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="企业地址：" prop="address" label-position="left" :label-width="150">
                                    <Input :disabled="hasSubmit" v-model="userData.address" type="textarea" :rows="2" placeholder="请输入企业地址" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="企业类型：" prop="partyType" label-position="left" :label-width="150">
                                    <Radio-group v-model="userData.partyType">
                                        <!--<Radio :label="1">2P</Radio>-->
                                        <Radio :label="2">4S</Radio>
                                        <Radio :label="3">监管店</Radio>
                                        <Radio :label="4">2B</Radio>
                                        <Radio :label="5">小b</Radio>
                                        <Radio :label="6">个人</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <!--2019-9-9  gyp 和前端保持一致-->
                        <!--
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="营业执照号：" label-position="left" :label-width="150">
                                    <Input :disabled="hasSubmit" v-model="userData.businessLicense" type="text" placeholder="营业执照号不能为空" />
                                </FormItem>
                            </i-col>
                        </Row>-->
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="申请人真实姓名：" label-position="left" :label-width="150">
                                    <Input :disabled="hasSubmit" v-model="userData.applyRealName" type="text"  />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="申请人手机号：" label-position="left" :label-width="150">
                                    <Input :disabled="hasSubmit" v-model="userData.applyMobile" type="text" />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="申请人身份证号：" label-position="left" :label-width="150">
                                    <Input :disabled="hasSubmit" v-model="userData.applyCarNum" type="text"  />
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="用户角色：" prop="userRoles" label-position="left" :label-width="150">
                                   <Radio-group v-model="userData.userRoles">
                                        <Radio :label="1">法人</Radio>
                                        <Radio :label="2">签约代理人</Radio>
                                        <Radio :label="3">销售经理</Radio>
                                        <Radio :label="4">非企业员工</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="12" >
                                <FormItem label="发布车源：" prop="is_car" label-position="left" :label-width="150">
                                   <Radio-group v-model="userData.isCar">
                                        <Radio :label="0">禁止</Radio>
                                        <Radio :label="1">允许</Radio>
                                    </Radio-group>
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="10">
                                <FormItem label="营业执照图片：" label-position="left" :label-width="150">
                                    <img v-if="userData.businessLicenseUrl !== ''" :src="userData.businessLicenseUrl" height="200" width="200">
                                </FormItem>
                            </i-col>
                        </Row>
                        <!--2019-9-9  gyp 和前端保持一致-->
                        <!--<Row span="12">
                            <i-col span="10">
                                <FormItem label="门头照：" label-position="left" :label-width="150">
                                    <img v-if="userData.doorHeaderUrl !== ''" :src="userData.doorHeaderUrl" height="200" width="200">
                                </FormItem>
                            </i-col>
                        </Row>-->
                        <Row span="12">
                            <i-col span="10">
                                <FormItem label="身份证正面：" label-position="left" :label-width="150">
                                    <img v-if="userData.cardUrl !== ''" :src="userData.cardUrl" height="200" width="200">
                                </FormItem>
                            </i-col>
                        </Row>
                        <Row span="12">
                            <i-col span="10">
                                <FormItem label="身份证背面：" label-position="left" :label-width="150">
                                    <img v-if="userData.cardBackUrl !== ''" :src="userData.cardBackUrl" height="200" width="200">
                                </FormItem>
                            </i-col>
                        </Row>
                        <FormItem >
                            <Button @click="back" style="width:100px;" >返回</Button>
                        </FormItem>
                    </Form>
                </div>
            </Card>
    </div>
</template>


<script>
import ajax from '../../../libs/axios.js'
export default {
    name: 'addUser',
    data () {
        return {
            hasSubmit: true,           // 不可点击/可点击状态
            // 图片上传
            file: null,
            status: 'wait',
            uploadLoading: false,       // 上传图片时候的加载效果,
            failreason:"",              // 审核失败
            userId:-1,                  // 当前登陆人员的Id
            userName:"",                // 当前登陆人员的姓名
            id:-1,
            uid:'',
            userData: {
                id:'',
                name:'',                // 企业名称
                legalPerson:'',         //
                legalCard:'',
                legalPhone: '',
                businessLicense:'',
                businessLicenseUrl:'',
                cardUrl:'',
                cardBackUrl:'',
                doorHeaderUrl:'',
                applyRealName:'',        // 申请人真实姓名
                applyMobile:'',          // 申请人手机号
                applyCarNum:'',          // 申请人身份证号码
                uid:''                   // 申请人的Id
            },
        }
    },
    created () {
        this.init()
    },
    activated () {
        this.init()
    },
    methods: {
        // 数据初始化
        init () {
            this.userId = window.localStorage.getItem('userId')
            this.userName = window.localStorage.getItem('userName')
            this.$store.commit('setActiveName', 'partypersonalindex');
            var uid = this.$route.params.id;
            this.uid = uid;
            this.personalInfo(uid);
        },
        // 获取数据
        personalInfo(uid){
            let _that = this;
            let url = 'adminlogin/selectPartyInfoByUserId'
            let data = {
                id: uid
            }
            ajax.formRes(url, data).then(res => {
                //success
                if(200 == res.code){
                    _that.userData = res.data;
                }else{
                    _that.$Message.success('数据原因，请联系管理员。')
                }
            }).catch(err => {
                _that.$Message.success('数据原因，请联系管理员。')
                console.log('有错误信息')
            })
        },
        // 返回列表
        back () {
            let argu = {}
             this.$router.push({
                name: 'partypersonalindex',
                params: argu
            })
        }
    },
}
</script>
<style>
    .demo-upload-list-cover{
        display: none;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(0,0,0,.6);
    }
    .card-upload:hover .demo-upload-list-cover{
        display: block;
    }
    .demo-upload-list-cover i{
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        margin: 0 2px;
    }
    .demo-spin-icon-load{
        animation: ani-demo-spin 1s linear infinite;
    }
    @keyframes ani-demo-spin {
        from { transform: rotate(0deg);}
        50%  { transform: rotate(180deg);}
        to   { transform: rotate(360deg);}
    }
    .demo-spin-col{
        height: 100px;
        position: relative;
        border: 1px solid #eee;
    }
</style>

